<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('申请售后')" />
    <th:block th:include="include :: ztree-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-order-saleAfter" th:object="${order}">
        <input id="orderId" name="orderId" type="hidden" th:field="*{orderId}"/>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">设备名称：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="deviceName" id="deviceName" th:field="*{deviceName}" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">设备编号：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="deviceCode" id="deviceCode" th:field="*{deviceCode}" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">产品问题：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="cause" id="cause" required>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<script type="text/javascript">

    function edit() {
        var orderId = $("input[name='orderId']").val();
        var deviceName = $("input[name='deviceName']").val();
        var deviceCode = $("input[name='deviceCode']").val();
        var cause = $("input[name='cause']").val();
        $.ajax({
            cache : true,
            type : "POST",
            url : ctx + "system/order/apply",
            data : {
                "orderId": orderId,
                "deviceName": deviceName,
                "deviceCode": deviceCode,
                "cause": cause
            },
            async : false,
            error : function(request) {
                $.modal.alertError("系统错误");
            },
            success : function(data) {
                $.operate.successCallback(data);
            }
        });
    }

    function submitHandler() {
        edit();
    }
</script>
</body>
</html>
